package cn.iocoder.yudao.module.member.dal.mysql.praxisProjectType;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.praxisProjectType.vo.PraxisProjectTypeExportReqVO;
import cn.iocoder.yudao.module.member.controller.admin.praxisProjectType.vo.PraxisProjectTypePageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.praxisProjectType.PraxisProjectTypeDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 实践项目类型 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface PraxisProjectTypeMapper extends BaseMapperX<PraxisProjectTypeDO> {

    default PageResult<PraxisProjectTypeDO> selectPage(PraxisProjectTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PraxisProjectTypeDO>()
                .likeIfPresent(PraxisProjectTypeDO::getName, reqVO.getName())
                .eqIfPresent(PraxisProjectTypeDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PraxisProjectTypeDO::getWeight, reqVO.getWeight())
                .orderByDesc(PraxisProjectTypeDO::getWeight));
    }

    default List<PraxisProjectTypeDO> selectList(PraxisProjectTypeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<PraxisProjectTypeDO>()
                .likeIfPresent(PraxisProjectTypeDO::getName, reqVO.getName())
                .eqIfPresent(PraxisProjectTypeDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PraxisProjectTypeDO::getWeight, reqVO.getWeight())
                .orderByDesc(PraxisProjectTypeDO::getWeight));
    }
    void updateProjectTypeSort(@Param("list") List<PraxisProjectTypeDO> list);

    Integer getMaxWeight();
}
